<?php
// 本类由系统自动生成，仅供测试用途
class UploadAction extends Action {
	function disease(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			$data['image']=$upload->savePath.$info[0]['savename'];
			$save = M('Disease')->where("id=1")->save($data);
			if($save!==false){
				$json['status']=1;
				$json['image']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}


	function medicalimg(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			if($save!==false){
				$json['status']=1;
				$json['image']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}

	function medicalimgs(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="文件上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			if($save!==false){
				$json['status']=1;
				$json['image']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="文件保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}


	function clinical(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			$data['image']=$upload->savePath.$info[0]['savename'];
			$save = M('Clinical')->where("id=1")->save($data);
			if($save!==false){
				$json['status']=1;
				$json['imgurl']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}

	function clinicalcat(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			$data['image']=$upload->savePath.$info[0]['savename'];
			$condition['id'] = I('id',0);

			$save = M('ClinicalCat')->where($condition)->save($data);

			if($save!==false){
				$json['status']=1;
				$json['imgurl']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}

	function interpret(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			$data['image']=$upload->savePath.$info[0]['savename'];
			$save = M('Interpret')->where("id=1")->save($data);
			if($save!==false){
				$json['status']=1;
				$json['imgurl']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}

	function hospital(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			if($save!==false){
				$json['status']=1;
				$json['imgurl']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}

	function user(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			if($save!==false){
				$json['status']=1;
				$json['imgurl']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}

	function consult(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			$data['image']=$upload->savePath.$info[0]['savename'];
			$save = M('Consult')->where("id=1")->save($data);
			if($save!==false){
				$json['status']=1;
				$json['imgurl']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}

	function consultcat(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			$data['image']=$upload->savePath.$info[0]['savename'];
			$condition['id']=I('id',0);
			$save = M('Consult')->where($condition)->save($data);
			if($save!==false){
				$json['status']=1;
				$json['imgurl']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}

	function home(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			$data['image']=$upload->savePath.$info[0]['savename'];
			$save = M('Home')->where("id=1")->save($data);
			if($save!==false){
				$json['status']=1;
				$json['imgurl']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}
	function book(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			if($save!==false){
				$json['status']=1;
				$json['imgurl']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}

	function doctors(){
		import('ORG.Net.UploadFile');
		$upload = new UploadFile();// 实例化上传类
		//$upload->maxSize  = 3145728 ;// 设置附件上传大小
		$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
		$upload->savePath =  'Public/Uploads/'.date('Ymd')."/";// 设置附件上传目录
		 if(!$upload->upload()) {// 上传错误提示错误信息
			$json['status']=0;
			$json['msg']="图片上传失败";
		 }else{// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			if($save!==false){
				$json['status']=1;
				$json['imgurl']=$upload->savePath.$info[0]['savename'];
				$json['target']=I('target');
			}else{
				$json['status']=0;
				$json['msg']="图片保存失败";
			}
		 }
		 $this->ajaxReturn($json,'JSON');		
	}		
}